<template>
  <div class="plans-section">
    <div class="plans-grid">
      <div
        v-for="plan in plans"
        :key="plan.id"
        class="plan-item"
        :class="plan.class"
        @click="handlePlanClick(plan)"
      >
        <div class="plan-icon">
          <img :src="plan.icon" :alt="plan.title" />
        </div>
        <div class="plan-content">
          <h4 class="plan-title">{{ plan.title }}</h4>
          <p class="plan-subtitle">{{ plan.subtitle }}</p>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ElMessage } from 'element-plus'

const plans = [
  {
    id: 1,
    title: '谷粒计划',
    subtitle: '在校生',
    icon: '/src/assets/imgs/bag.svg',
    class: 'plan-student'
  },
  {
    id: 2,
    title: '精英计划',
    subtitle: '毕业生',
    icon: '/src/assets/imgs/crown.svg',
    class: 'plan-graduate'
  },
  {
    id: 3,
    title: '企业计划',
    subtitle: '打工人',
    icon: '/src/assets/imgs/bag.svg',
    class: 'plan-enterprise'
  },
  {
    id: 4,
    title: 'English',
    subtitle: 'lao wai',
    icon: '/src/assets/imgs/journey.svg',
    class: 'plan-english'
  }
]

const handlePlanClick = (plan) => {
  ElMessage.info(`选择了${plan.title}`)
  console.log('计划点击:', plan)
}
</script>

<style scoped>
.plans-section {
  margin: 0 16px 20px;
}

.plans-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.plan-item {
  position: relative;
  background-color: #fff;
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 1px solid #f0f0f0;
  overflow: hidden;
  min-height: 80px;
  display: flex;
  align-items: center;
}

.plan-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.plan-student {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.plan-graduate {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
}

.plan-enterprise {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  color: white;
}

.plan-english {
  background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
  color: white;
}

.plan-icon {
  width: 32px;
  height: 32px;
  margin-right: 12px;
  flex-shrink: 0;
}

.plan-icon img {
  width: 100%;
  height: 100%;
  filter: brightness(0) invert(1);
}

.plan-content {
  flex: 1;
}

.plan-title {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 4px 0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.plan-subtitle {
  font-size: 12px;
  margin: 0;
  opacity: 0.9;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.plan-decoration {
  position: absolute;
  right: 8px;
  top: 8px;
  width: 20px;
  height: 20px;
  opacity: 0.7;
}

.plan-decoration img {
  width: 100%;
  height: 100%;
  filter: brightness(0) invert(1);
}

/* 响应式设计 */
@media (max-width: 768px) {
  .plans-section {
    margin: 0 12px 16px;
  }
  
  .plans-grid {
    gap: 8px;
  }
  
  .plan-item {
    padding: 12px;
    min-height: 70px;
  }
  
  .plan-icon {
    width: 28px;
    height: 28px;
    margin-right: 8px;
  }
  
  .plan-title {
    font-size: 13px;
  }
  
  .plan-subtitle {
    font-size: 11px;
  }
}
</style>
